package com.ks.core.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 封装的异常
 *
 * @author kingdee
 * @Date 2019/11/26 下午10:32
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class GunsException extends RuntimeException {

    private Integer code;

    private String message;

    private GunsError data;

    private String version;

    public GunsException(ServiceExceptionEnum serviceExceptionEnum) {
        this.code = serviceExceptionEnum.getCode();
        this.message = serviceExceptionEnum.getMessage();
    }

    public GunsException(String message) {
        this.code = 500;
        this.message = message;
    }
    public GunsException(Integer code,String message){
        this.code = code;
        this.message =message;
    }

    public GunsException(ServiceExceptionEnum serviceExceptionEnum,ServiceExceptionEnum ExceptionEnum) {
        this.code = serviceExceptionEnum.getCode();
        this.message = serviceExceptionEnum.getMessage();
        this.data = new GunsError(ExceptionEnum);
        this.version = "0.1";
    }


}
